#lang racket


(require "../version.rkt")

(provide load-user-config
         
         ; apps
         apps-dir
         
         set-apps-dir!
         
         ; render
         render-dir
         render-ext
         render-height
         render-width
         render-floor?
         render-floor-width
         render-floor-height
         render-floor-color
         
         set-render-dir
         set-render-ext
         set-render-height
         set-render-width
         set-render-floor?
         set-render-floor-width
         set-render-floor-height
         set-render-floor-color
         
         ; distros
         distro-dir
         set-distro-dir)


; edit: totally hack!
(define (current-user)
  (path->string (file-name-from-path (find-system-path 'home-dir))))

(define (load-user-config)
  (let ((config-file (format "config-~A.rkt" (current-user)))
        (config-dir (format "~Aconfig\\" (rosetta-dir))))
    (let ((config-path (build-path (string-append config-dir config-file))))
      (when (file-exists? config-path)
        (dynamic-require config-path 0)))))


; apps

(define apps-dir (make-parameter (build-path (rosetta-dir) "apps")))


(define (set-apps-dir! val)
  (set! apps-dir (make-parameter val)))


; render

(define render-dir (make-parameter (find-system-path 'desk-dir)))
(define render-ext (make-parameter "png"))
(define render-height (make-parameter 300))
(define render-width (make-parameter 300))
(define render-floor? (make-parameter #t))
(define render-floor-width (make-parameter 1000))
(define render-floor-height (make-parameter 1000))
(define render-floor-color (make-parameter 'white))


(define (set-render-dir val)
  (set! render-dir (make-parameter (path->directory-path (build-path val)))))

(define (set-render-ext val)
  (set! render-ext (make-parameter val)))

(define (set-render-height val)
  (set! render-height (make-parameter val)))

(define (set-render-width val)
  (set! render-width (make-parameter val)))

(define (set-render-floor? val)
  (set! render-floor? (make-parameter val)))

(define (set-render-floor-width val)
  (set! render-floor-width (make-parameter val)))

(define (set-render-floor-height val)
  (set! render-floor-height (make-parameter val)))

(define (set-render-floor-color val)
  (set! render-floor-color (make-parameter val)))


; distros

(define distro-dir (make-parameter (find-system-path 'desk-dir)))

(define (set-distro-dir val)
  (set! distro-dir (make-parameter (build-path val))))